<?php /*a:3:{s:69:"D:\projects\original_admin\app\merchant\view\finance\finance_log.html";i:1755332952;s:61:"D:\projects\original_admin\app\merchant\view\common\base.html";i:1752764603;s:63:"D:\projects\original_admin\app\merchant\view\common\header.html";i:1754830154;}*/ ?>
<!DOCTYPE html>
<html lang="zh-CN">

<head>
	<meta charset="UTF-8" />
	<meta name="renderer" content="webkit" />
	<meta name="force-rendering" content="webkit" />
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>管理系统</title>
	<script src="/static/merchant/js/jquery-min.js"></script>
	<link rel="stylesheet" href="/static/merchant/layui/css/layui.css">
	<script type="text/javascript" src="/static/merchant/layui/layui.js"></script>
	<link rel="stylesheet/less" type="text/css" href="/static/merchant/css/index.less" />
	<script src="/static/merchant/js/less.js"></script>
    
</head>
<body>
	<main class="CenterMain">
		<header class="Header">
    <div class="logo img_box">
        <img src="/static/merchant/images/logow.png">

    </div>
    <div class="top">
        <ul class="nav-buttons">
            <li id="toggle-btn">

                <span class="desktop-text layui-icon layui-icon-spread-left">
                </span>
                <span class="mobile-text">菜单</span>
            </li>
        </ul>
        <dl class="menu-btn">
            <a class="img_box ">
                <img src="/static/merchant/images/head1.png">
                <i class="msg"></i>
            </a>
            <a class="img_box">
                <img src="/static/merchant/images/head2.png">
            </a>
        </dl>
        <span class="hr"></span>
        <ul class="layui-nav">

            <li class="layui-nav-item" lay-unselect>
                <a href="javascript:;">
                    <img  src="<?php echo htmlentities((string) (isset($userInfo['shop_thumb']) && ($userInfo['shop_thumb'] !== '')?$userInfo['shop_thumb']:'/static/merchant/images/sign-user.png')); ?>" class="layui-nav-img">
                    <span><?php echo htmlentities((string) $userInfo['shop_name']); ?></span>
                </a>
                <dl class="layui-nav-child">
                    <!-- <dd><a href="account_info.html">个人信息</a></dd> -->
                    <dd><a href="/merchant/account_pwd.html">密码修改</a></dd>
                    <dd style="text-align: center;"><a href="/merchant/login_out">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>

</header>
<div class="Sidebar" id="sidebar">
    <ul class="menu">
        <li class="menu-item">
            <div lay-on="url" href="/" class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav22.png">
                    <img class="img2" src="/static/merchant/images/nav21.png">
                </div>
                <span>商品管理</span>
                <!-- <i class="layui-icon layui-icon-right"></i> -->
            </div>
        </li>
        <li class="menu-item <?php if($routers == 'order/list' || $routers == 'order/shop_back' || $routers == 'order/review'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav32.png">
                    <img class="img2" src="/static/merchant/images/nav31.png">
                </div>
                <span>订单管理</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>
            <dl    <?php if($routers == 'order/list' || $routers == 'order/shop_back' || $routers == 'order/review'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?> >
                <dd>
                    <a href="/merchant/order.html"  <?php if($routers == 'order/list'): ?>  class="active" <?php endif; ?> >订单管理</a>
                </dd>
                <dd>
                    <a href="/merchant/shop_back.html" <?php if($routers == 'order/shop_back'): ?>  class="active" <?php endif; ?>>退货管理</a>
                </dd>
                <dd>
                    <a href="/merchant/review.html" <?php if($routers == 'order/review'): ?>  class="active" <?php endif; ?>>订单评价</a>
                </dd>

            </dl>

        </li>
        <li class="menu-item <?php if($routers == 'finance/finance_cash' || $routers == 'finance/finance_account' || $routers == 'finance/finance_log' || $routers == 'finance/finance_logs'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav42.png">
                    <img class="img2" src="/static/merchant/images/nav41.png">
                </div>
                <span>财务提现</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

            <dl  <?php if($routers == 'finance/finance_cash' || $routers == 'finance/finance_account' || $routers == 'finance/finance_log' || $routers == 'finance/finance_logs'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?>>
                <dd>
                    <a  <?php if($routers == 'finance/finance_cash'): ?>  class="active" <?php endif; ?> href="/merchant/finance_cash.html">提现</a>
                </dd>
                <dd>
                    <a  <?php if($routers == 'finance/finance_logs'): ?>  class="active" <?php endif; ?> href="/merchant/finance_logs.html">记录</a>
                </dd>
            </dl>

        </li>
        <!-- <li class="menu-item ">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="images/nav52.png">
                    <img class="img2" src="images/nav51.png">
                </div>
                <span>消息中心</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

        </li> -->
        <li class="menu-item <?php if($routers == 'store/store_info' || $routers == 'store/store_notice' || $routers == 'store/store_model'): ?>  active <?php endif; ?>">
            <div class="title">
                <div class="img img_box">
                    <img class="img1" src="/static/merchant/images/nav62.png">
                    <img class="img2" src="/static/merchant/images/nav61.png">
                </div>
                <span>店铺设置</span>
                <i class="layui-icon layui-icon-right"></i>
            </div>

            <dl <?php if($routers == 'store/store_info' || $routers == 'store/store_notice' || $routers == 'store/store_model'): ?>  style="display: block;" <?php else: ?> style="display:none;" <?php endif; ?>>
                <dd>
                    <a  <?php if($routers == 'store/store_info'): ?>  class="active" <?php endif; ?> href="/merchant/store_info.html">店铺信息 </a>
                </dd>
                <dd>
                    <a <?php if($routers == 'store/store_notice'): ?>  class="active" <?php endif; ?> href="/merchant/store_notice.html">店铺公告</a>
                </dd>
                <dd>
                    <a <?php if($routers == 'store/store_model'): ?>  class="active" <?php endif; ?>  href="/merchant/store_model.html">运费模板</a>
                </dd>
            </dl>

        </li>
    </ul>
</div>
		 
<style>
    .layui-form-label{
        width: 100px;
    }
</style>
<div class="Content" id="content">
    <div class="container">
        <div class="cashNav">
            <a class="item " href="finance_cash.html">提现</a>
            <a class="item active" href="finance_log.html">提现记录</a>
            <a class="item " href="finance_account.html">提现账户</a>
        </div>

        <table class="layui-hide" id="withdrawTable" lay-filter="withdrawTable"></table>

    </div>
</div>
    <script type="text/html" id="addLayerTpl">
        <div class="layui-form" style="padding: 20px;">
        <div class="layui-form-item">
            <label class="layui-form-label">提现金额</label>
            <div class="layui-input-block">
            <input type="text" name="amount" placeholder="请输入提现金额" class="layui-input" required>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提现时间</label>
            <div class="layui-input-block">
            <input type="text" name="time" placeholder="如 2025-06-12" class="layui-input" required>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提现账户</label>
            <div class="layui-input-block">
            <input type="text" name="account" placeholder="请输入提现账户" class="layui-input" required>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
            <select name="status">
                <option value="提现中">提现中</option>
                <option value="完成">完成</option>
            </select>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="saveAdd">提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
        </div>
    </script>


    <script type="text/html" id="operateTpl">
        <div class="foot">
            <a class="btn-edit" lay-event="view">查看</a> 
            {{#  if(d.status == 0){ }}
            <span>|</span>
            <a class="btn-delete" lay-event="cancel">取消</a>
            {{#  } }}
        </div>
    </script>


	</main>
</body>
<script  src="/static/merchant/js/index.js"></script>
<script src="/static/merchant/js/base.js"></script>
 
<script>
    changeTitleName('提现记录');
    
    layui.use(['table', 'layer', 'form'], function () {
        var table = layui.table;
        var layer = layui.layer;
        var form = layui.form;
        // 渲染表格
        var tableIns  = table.render({
            elem: '#withdrawTable',
            url: '/merchant/merchant-finance-log',
            cols: [[
                { field: 'amount', title: '提现金额', maxWidth: 300, minWidth: 150 },
                {
                    field: 'account_info', title: '提现账户'
                    , maxWidth: 300, minWidth: 150
                },
                {
                    field: 'account_user', 
                    title: '收款用户', 
                    maxWidth: 300, 
                    minWidth: 150,
                    templet: function(d){
                      // 组合显示收款用户信息
                      var html = [];
                      if (d.enc_true_name) {
                        html.push('<div><span style="font-weight:bold;">' + d.enc_true_name + '</span></div>');
                      }
                      if (d.enc_bank_no) {
                        // 显示银行卡号（通常需要脱敏处理）
                        var bankNo = d.enc_bank_no;
                        if (bankNo.length > 8) {
                            bankNo = bankNo.substring(0, 4) + ' **** **** ' + bankNo.substring(bankNo.length - 4);
                          }
                        html.push('<div style="color:#666;margin-top:2px;">银行卡: ' + bankNo + '</div>');
                      }
                      if (d.bank_code) {
                        // 这里假设 bank_code 是银行代码，你可能需要从 banks 表获取银行名称
                        // 如果有 bank_name 字段可以直接使用 d.bank_name
                        html.push('<div style="color:#888;margin-top:2px;">开户行: ' + (d.bank_name) + '</div>');
                      }
                      return html.join('');
                    }
                  },
                { field: 'commission', title: '手续费', maxWidth: 300, minWidth: 150 },
                { field: 'real_amount', title: '实际金额', maxWidth: 300, minWidth: 150 },
              
                {
                    field: 'status', 
                    title: '状态', 
                    width: 200, 
                    templet: function (d) {
                        var statusClass = '';
                        var statusName = '';
                        
                        switch (d.status) {
                            case 0: 
                                statusClass = 'layui-badge layui-bg-orange'; 
                                statusName = "待审核";
                                break;
                            case 1: 
                                statusClass = 'layui-badge layui-bg-blue'; 
                                statusName = "审核通过"; 
                                break;
                            case 2: 
                                statusClass = 'layui-badge layui-bg-prop';
                                statusName = "审核未通过"; 
                                break;
                            case 3: 
                                statusClass = 'layui-badge layui-bg-prop';
                                statusName = "已取消"; 
                                break;
                            default:
                                statusClass = 'layui-badge'; 
                                statusName = "未知状态(" + d.status + ")";
                        }
                        
                        return '<span class="' + statusClass + '">' + statusName + '</span>';
                    }
                },
                { field: 'create_time', title: '申请时间', maxWidth: 300, minWidth: 150 },
                {
                    field: 'operate', title: '操作',
                    toolbar: '#operateTpl',
                    width: 160
                }
            ]],
            page: true,
            limit: 10,
            limits: [10, 20, 30]
        });


        // 监听表格工具事件（查看、取消）
         table.on('tool(withdrawTable)', function (obj) {
            var data = obj.data;
            console.log(data)
            if (obj.event === 'view') {
                // 查看弹窗
                layer.open({
                    type: 1,
                    title: '查看提现记录',
                    skin: 'xieyiDialog',
                    content: `
                     <div class="layui-form" style="padding: 20px;">
                        <div class="layui-form-item">
                            <label class="layui-form-label">提现金额</label>
                            <div class="layui-input-block">
                            <input type="text" name="amount" value="`+ data.amount + `" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">提现时间</label>
                            <div class="layui-input-block">
                            <input type="text" name="time" value="`+ data.create_time + `" class="layui-input" disabled>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">收款方银行卡号</label>
                            <div class="layui-input-block">
                            <input type="text" name="account" value="`+ data.enc_bank_no + `" class="layui-input" disabled>
                            </div>
                        </div >
                        <div class="layui-form-item">
                            <label class="layui-form-label">收款方用户名</label>
                            <div class="layui-input-block">
                            <input type="text" name="account" value="`+ data.enc_true_name + `" class="layui-input" disabled>
                            </div>
                        </div >
                        <div class="layui-form-item">
                            <label class="layui-form-label">收款方开户行</label>
                            <div class="layui-input-block">
                            <input type="text" name="account" value="`+ data.bank_name + `" class="layui-input" disabled>
                            </div>
                        </div >
                        <div class="layui-form-item">
                            <label class="layui-form-label">状态</label>
                            <div class="layui-input-block">
                                <input type="text" name="status" value="`+ data.status_text + `" class="layui-input" disabled>
                            </div>
                        </div>
                     </div >
                    `,
                    area: ['600px', '500px'],
                    success: function (layero, index) {
                        form.render(); // 渲染表单（主要是让 disabled 生效等）
                    },
                });
            } else if (obj.event === 'cancel') {
                // 取消弹窗
                layer.confirm('确定要取消该申请吗？', function(index) {
                    // 执行取消操作
                    $.post('/merchant/merchant-finance-cancel', {id: data.id}, function(res) {
                        if(res.code === 200) {
                            layer.msg('取消成功');
                            tableIns.reload();
                        } else {
                            layer.msg(res.msg || '取消失败');
                        }
                    });
                    layer.close(index);
                });

            }
        });
    });
</script>
>
</html>